<!DOCTYPE html><html lang="zh-CN"><head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>&#x89E3;&#x6790; | Moment.js &#x6587;&#x6863;</title>
  <link rel="stylesheet" href="static/css/style.css">
  <link rel="shortcut icon" href="http://momentjs.cn/static/img/moment-favicon.png">
  <link rel="stylesheet" href="static/css/atom-one-light.min.css">
</head>
<body class="is-moment">
  <div class="hero hero-oneline">
    <div class="hero-centered">
      <h1>&#x89E3;&#x6790;</h1>
    </div>
  </div>
  <div id="api-section-__FILENAME__">
    <div id="content" class="clearfix">
  
      <div id="column1" data-id="__ID__" class="interior">
        <header>
          <!-- <h1>解析</h1> -->
          <div id="gtoc">
            <ul>
              <!-- <li>v</li> -->
              <li>
                <a href="index.html#/parsing/" name="toc">&#x8FD4;&#x56DE;&#x4E0A;&#x5C42;&#x6587;&#x6863;</a>
              </li>
              <li style="border: none;">
                <a href="javascript:window.open('https://github.com/momentjscn/moment-docs-cn/edit/master/moment/01-parsing/00-intro.md');" rel="nofollow" target="_blank">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a>
              </li>
              <!-- <li>
                <a href="/search__SEARCH_PARAM__" name="toc">搜索</a>
              </li> -->
            </ul>
          </div>
          <hr>
        </header>

        <div id="biz_item"></div>
  
        <div id="apicontent">
          <div id="content_left">
<p>Moment.js &#x4F1A;&#x4E3A; <code>Date</code> &#x5BF9;&#x8C61;&#x521B;&#x5EFA;&#x5C01;&#x88C5;&#x5668;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x4FEE;&#x6539;&#x672C;&#x5730;&#x7684; <code>Date.prototype</code>&#x3002;
&#x82E5;&#x8981;&#x83B7;&#x53D6;&#x6B64;&#x5C01;&#x88C5;&#x5668;&#x5BF9;&#x8C61;&#xFF0C;&#x5219;&#x53EA;&#x9700;&#x4F7F;&#x7528;&#x4E00;&#x79CD;&#x53D7;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x7C7B;&#x578B;&#x8C03;&#x7528; <code>moment()</code> &#x5373;&#x53EF;&#x3002;</p>
<p><code>Moment</code> &#x539F;&#x578B;&#x901A;&#x8FC7; <code>moment.fn</code> &#x516C;&#x5F00;&#x3002;
&#x5982;&#x679C;&#x8981;&#x6DFB;&#x52A0;&#x81EA;&#x5DF1;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5728;&#x5176;&#x4E2D;&#x653E;&#x7F6E;&#x5B83;&#x4EEC;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x4FBF;&#x4E8E;&#x53C2;&#x8003;&#xFF0C;<code>Moment.prototype</code> &#x4E0A;&#x7684;&#x4EFB;&#x4F55;&#x65B9;&#x6CD5;&#x90FD;&#x5C06;&#x4F1A;&#x5728;&#x6587;&#x6863;&#x4E2D;&#x79F0;&#x4E3A; <code>moment&#xFF03;method</code>&#x3002;
&#x56E0;&#x6B64; <code>Moment.prototype.format</code> == <code>moment.fn.format</code> == <code>moment&#xFF03;format</code>&#x3002;</p>
<p><strong>&#x8BF7;&#x9605;&#x8BFB;&#xFF1A;</strong></p>
<ul>
<li><code>moment(...)</code> &#x662F;&#x672C;&#x5730;&#x6A21;&#x5F0F;&#x3002;&#x4E0D;&#x660E;&#x786E;&#x7684;&#x8F93;&#x5165;&#xFF08;&#x65E0;&#x504F;&#x79FB;&#x91CF;&#xFF09;&#x4F1A;&#x88AB;&#x5047;&#x5B9A;&#x4E3A;&#x672C;&#x5730;&#x65F6;&#x95F4;&#x3002;&#x660E;&#x786E;&#x7684;&#x8F93;&#x5165;&#xFF08;&#x5E26;&#x504F;&#x79FB;&#x91CF;&#xFF09;&#x4F1A;&#x88AB;&#x8C03;&#x6574;&#x4E3A;&#x672C;&#x5730;&#x65F6;&#x95F4;&#x3002;</li>
<li><code>moment.utc(...)</code> &#x662F; utc &#x6A21;&#x5F0F;&#x3002;&#x4E0D;&#x660E;&#x786E;&#x7684;&#x8F93;&#x5165;&#x4F1A;&#x88AB;&#x5047;&#x5B9A;&#x4E3A; UTC&#x3002;&#x660E;&#x786E;&#x7684;&#x8F93;&#x5165;&#x4F1A;&#x88AB;&#x8C03;&#x6574;&#x4E3A; UTC&#x3002;</li>
<li><code>moment.parseZone()</code> &#x4F1A;&#x4FDD;&#x6301;&#x8F93;&#x5165;&#x7684;&#x533A;&#x57DF;&#x88AB;&#x4F20;&#x5165;&#x3002;&#x5982;&#x679C;&#x8F93;&#x5165;&#x4E0D;&#x660E;&#x786E;&#xFF0C;&#x5219;&#x4E0E;&#x672C;&#x5730;&#x6A21;&#x5F0F;&#x76F8;&#x540C;&#x3002;</li>
<li><code>moment.tz(...)</code> &#x4F7F;&#x7528; moment-timezone &#x63D2;&#x4EF6;&#x53EF;&#x4EE5;&#x4EE5;&#x7279;&#x5B9A;&#x7684;&#x65F6;&#x533A;&#x6765;&#x89E3;&#x6790;&#x8F93;&#x5165;&#x3002;</li>
</ul>
<p>&#x8BB0;&#x4F4F;&#xFF0C;&#x65F6;&#x533A;&#x548C;&#x65F6;&#x533A;&#x504F;&#x79FB;&#x662F;&#x4E24;&#x4EF6;&#x4E8B;&#x3002;
-08:00 &#x7684;&#x504F;&#x79FB;&#x91CF;&#x4E0D;&#x4E00;&#x5B9A;&#x610F;&#x5473;&#x7740;&#x4F60;&#x5904;&#x4E8E;&#x7F8E;&#x56FD;&#x592A;&#x5E73;&#x6D0B;&#x65F6;&#x533A;&#x3002;</p>
<p><a href="javascript:window.open('http://nodejs.cn/s/vPwJST');" target="_blank" rel="nofollow">&#x6709;&#x5173;&#x5176;&#x4ED6;&#x4FE1;&#x606F;&#xFF0C;&#x53C2;&#x89C1;&#x89E3;&#x6790;&#x6307;&#x5357;</a>&#x3002;</p>
					</div>
          <div id="content_right">
<p>Instead of modifying the native <code>Date.prototype</code>, Moment.js creates a wrapper for the <code>Date</code> object. To get this wrapper object, simply call <code>moment()</code> with one of the supported input types.</p>
<p>The <code>Moment</code> prototype is exposed through <code>moment.fn</code>. If you want to add your own functions, that is where you would put them.</p>
<p>For ease of reference, any method on the <code>Moment.prototype</code> will be referenced in the docs as <code>moment#method</code>. So <code>Moment.prototype.format</code> == <code>moment.fn.format</code> == <code>moment#format</code>.</p>
<p><strong>Please read:</strong></p>
<ul>
<li><code>moment(...)</code> is local mode. Ambiguous input (without offset) is assumed to be local time. Unambiguous input (with offset) is adjusted to local time.</li>
<li><code>moment.utc(...)</code> is utc mode. Ambiguous input is assumed to be UTC. Unambiguous input is adjusted to UTC.</li>
<li><code>moment.parseZone()</code> keep the input zone passed in. If the input is ambiguous, it is the same as local mode.</li>
<li><code>moment.tz(...)</code> with the moment-timezone plugin can parse input in a specific time zone.</li>
</ul>
<p>Keep in mind that a time zone and a time zone offset are two different things. An offset of -08:00 doesn&apos;t necessarily mean you are in the US Pacific time zone.</p>
<p><a href="javascript:window.open('https://momentjs.com/guides/#/parsing/');" target="_blank" rel="nofollow">See the Parsing Guide for additional information</a>.</p>
					</div>
          <div></div>
        </div>
      </div>
    </div>
  </div>
  
  <script src="static/js/highlight.min.js"></script>
  <script src="static/js/javascript.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <script>var _hmt = _hmt || []; (function () { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?7a7f78c805fbacc7e075d34f153031aa"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();</script>

  <style>
    .hero-centered {
      margin: 0;
          margin-left: 10px;
    }
#gtoc ul {
  list-style: none;
  margin-left: 0;
  line-height: 1.5rem;
  padding: 0;
}
#gtoc>ul>li {
  display: inline;
  border-right: 1px solid #000;
  margin-right: .4rem;
  padding-right: .4rem;
}
#gtoc>ul>li>a {
  color: #61b2a7;
}
#content_left {
  width: 49%;float: left;border-right: 1px solid #eee;    padding-right: 2%;
}
#content_right {
float: left;width: 48%;margin-left: 3%;
}
#column1 {
  padding: 0 2rem;
}
  </style>


</body></html>